<template>
    <div>
        <h1 v-text="msg" ref="title"></h1>
        <button ref="btn" @click="showDom">Click Me</button>
        <School ref="sch"></School>
        <School></School>
        <School></School>
    </div>
</template>

<script>
    import School from './components/School.vue'
    export default {
        name: 'App',
        components: {
            School
        },
        data() {
            return {
                msg: 'Hello World!'
            }
        },
        methods: {
            showDom() {
                // 通过$refs获取dom元素
                console.log(this.$refs.title)
                console.log(this.$refs.btn)
                // School组件的实例对象
                console.log(this.$refs.sch)
            }
        }
    }
</script>